package com.powernode.spring6.service.Impl;

import com.powernode.spring6.dao.AccountDao;
import com.powernode.spring6.pojo.Account;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Transactional;

@Service("i1")
public class IsolationService1 {
    @Resource(name = "accountDao")
    private AccountDao accountDao;

    // 1号
    // 负责查询
    // 当前事务可以读取到别的事务没有提交的数据。
    // @Transactional(isolation = Isolation.READ_UNCOMMITTED)
    @Transactional(isolation = Isolation.READ_COMMITTED)
    public void getByActNO(String actNo) {
        Account account = accountDao.selectByAct(actNo);
        System.out.println("查询到用户数据" + account);
    }
}
